home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13012 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: news.ov.com!news
  2. From: glenn@ov.com (Fletcher.Glenn@ov.com)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: returning an array from function
  5. Date: 3 Apr 1996 23:34:50 GMT
  6. Organization: OpenVision
  7. Message-ID: <4jv1ur$4fa@spanky.pls.ov.com>
  8. References: <4jstd8$kh0@news1.sunbelt.net>
  9. Reply-To: glenn@ov.com
  10. NNTP-Posting-Host: foghorn.pls.ov.com
  11.  
  12. In article kh0@news1.sunbelt.net, bourne@infoave.net (Rick Huebner) writes:
  13. >I have looked in several texts and looked through the faq for this question
  14. >and can't find a reference for my answer.  I am trying to return an array, or
  15. >a pointer to the array, from a function.  I have seen several examples of
  16. >returning a pointer, but it doesn't seem to work for me.  My function is going
  17. >to return an array of integers where 1-80 of them will be significant.  The
  18. >calling function will know how many integers are expected and will read them
  19. >off the array....If I can get the pointer back to the array.  A friend of mine
  20. >told me to just make the array a global, but I don't want to do that if I can
  21. >help it.  I would even resort to a recursive function that will pass the
  22. >integers back one at a time if that is possible.  Does anyone have any
  23. >suggestions?  I am open to anything and will go looking if you can tell me
  24. >where(hopefully online somewhere).
  25. >
  26. >Thanks...
  27. >
  28. >--
  29. >Rick Huebner EMT-P FF BS
  30. >Team OS/2    bourne@InfoAve.net
  31. >Warping along the Internet
  32. >
  33.  
  34. Since the calling function will know how much storage is required, the 
  35. calling function can provide local storage or dynamically allocated storage.
  36. Then the calling function can pass a pointer to this storage for use
  37. by your calculation routine.
  38.  
  39.             Fletcher.Glenn@ov.com
  40.  
  41.